﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Libs.Content;

public partial class Pages_News_Detail : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        int cateID = 0, newsID = 0;
        if (!NewsUtils.CheckUrl(ref cateID, ref newsID))
        {
            Response.Redirect(Constant.HOME_PATH);
        }
        NewsCategories _Cate = new NewsCategories();
        _Cate = _Cate.Get(cateID);
        if (_Cate.CateID == 0)
        {
            Response.Redirect(Constant.HOME_PATH);
        }

        hplCate.Text = _Cate.Name;
        hplCate.NavigateUrl = NewsUtils.CateLink(_Cate.CateID.ToString(), _Cate.Url, "0");

        News _News = new News();
        _News = _News.Get(newsID);
        if (_News.NewsID == 0 || _News.Status != 3)
        {
            Response.Redirect(Constant.HOME_PATH);
        }

        lblTime.Text = _News.PublishedTime.ToString("dd/MM/yyyy");
        lblTitle.Text = _News.Title;
        Title = _News.Title + " - " + Constant.SiteTitle;
        ltrContent.Text = _News.Content;

        NewsWeb _NewsWeb = new NewsWeb();
        rptOtherList.DataSource = _NewsWeb.GetList(_Cate.CateID, _News.NewsID, 10);
        rptOtherList.DataBind();
    }
}